.TH htsfile 1 "22 October 2021" "htslib-1.14" "Bioinformatics tools"
.SH NAME
htsfile \- identify high-throughput sequencing data files
.\"
.\" Copyright (C) 2015, 2017-2018 Genome Research Ltd.
.\"
.\" Author: John Marshall <jm18@sanger.ac.uk>
.\"
.\" Permission is hereby granted, free of charge, to any person obtaining a
.\" copy of this software and associated documentation files (the "Software"),
.\" to deal in the Software without restriction, including without limitation
.\" the rights to use, copy, modify, merge, publish, distribute, sublicense,
.\" and/or sell copies of the Software, and to permit persons to whom the
.\" Software is furnished to do so, subject to the following conditions:
.\"
.\" The above copyright notice and this permission notice shall be included in
.\" all copies or substantial portions of the Software.
.\"
.\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
.\" IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
.\" FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
.\" THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
.\" LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
.\" FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
.\" DEALINGS IN THE SOFTWARE.
.\"
.SH SYNOPSIS
.B htsfile
.RB [ -chHv ]
.IR FILE ...
.br
.B htsfile --copy
.RB [ -v ]
.I FILE DESTFILE
.SH DESCRIPTION
The \fBhtsfile\fR utility attempts to identify what kind of high-throughput
sequencing data files the specified files are, and provides minimal viewing
capabilities for some kinds of data file.
.P
It can identify sequencing data files such as SAM, BAM, and CRAM;
variant calling data files such as VCF and BCF;
index files used to index these data files;
and compressed versions of many of them.
.P
For each \fIFILE\fR given, \fBhtsfile\fP prints a description of the file
format determined, using similar keyword conventions to \fBfile\fP(1):
"text" indicates a textual file that can probably be viewed on a terminal;
"data" indicates binary data;
"sequence", "variant calling", and "index" indicate different categories of
data file.
When it can be identified, the name of the particular file format (such as
"BAM" or "VCF") is printed at the start of the description.
.P
When used to view file contents as text, \fBhtsfile\fP can optionally show
only headers or only data records, but has no other filtering capabilities.
Use \fBsamtools\fR or \fBbcftools\fR if you need more extensive viewing or
filtering capabilities.
.P
Alternatively, when \fB--copy\fR is used, \fBhtsfile\fR takes exactly two
arguments and performs a byte-for-byte copy from \fIFILE\fR to \fIDESTFILE\fR.
This is similar to \fBcp\fR(1), but HTSlib's remote file access facilities
are available for both source and destination.
.P
The following options are accepted:
.TP 4n
.BR -c ", " --view
Instead of identifying the specified files, display a textual representation
of their contents on standard output.
.IP
By default, \fB--view\fR refuses to display files in unknown formats.
When \fB--verbose\fR is also given, the raw contents of such files are
displayed, with non-printable characters shown via C-style "\\x" hexadecimal
escape sequences.
.TP
.BR -C ", " --copy
Instead of identifying or displaying the specified files, copy the source
\fIFILE\fR to the destination \fIDESTFILE\fR.
Only \fB--verbose\fR may be used in conjunction with \fB--copy\fR.
.TP
.BR -h ", " --header-only
Display data file headers only.
Implies \fB--view\fR.
.TP
.BR -H ", " --no-header
When viewing files, display data records only.
.TP
.BR -v ", " --verbose
Display additional warnings and diagnostic messages.
Using \fB--verbose\fR repeatedly further raises the verbosity.
.PP
.SH SEE ALSO
.IR bcftools (1),
.IR file (1),
.IR samtools (1)
